import { defineStore } from 'pinia'
import { ref } from 'vue'

export const usePupupStore = defineStore(
  'popup',
  () => {
    const showCancelPopup = ref(false)

    const changeCancelPopupStatus = (status: boolean) => {
      showCancelPopup.value = status
    }

    return {
      showCancelPopup,
      changeCancelPopupStatus,
    }
  },
  {
    persist: {
      storage: {
        setItem(key: string, value: any) {
          return uni.setStorageSync(key, value)
        },
        getItem(key: string) {
          return uni.getStorageSync(key)
        },
      },
    },
  },
)
